<!DOCTYPE html>
<html >
<head>
    <meta charset="UTF-8">
    <title>主生产计划</title>
    <script type="text/javascript">

        $(function () {
            //异步请求生产订单
            $.post("scgl_scjhmxselectAll_noBnag_limit", null,
                function (data) {
                   for(var i=0;i<data.length;i++){
                    var html="<tr>\n" +
                        "                     <td class=\"scgl_scgl_thirdtable_tr_td\"><input type='radio' name='my_radio' id='scgl_xuanzhe"+(i+1)+"' style='width: 20px;height: 20px' onclick=\"scgl_myradio('"+data[i].scglScjhmxItemnum+"','"+data[i].scglScjhmxDemandnum+"',"+(i+1)+")\" /></td>\n" +
                        "                     <td class=\"scgl_scgl_thirdtable_tr_td\">"+(i+1)+"</td>\n" +
                        "                     <td class=\"scgl_scgl_thirdtable_tr_td\">"+data[i].scglScjhmxItemnum+"</td>\n" +
                        "                     <td class=\"scgl_scgl_thirdtable_tr_td\">"+data[i].scglScjhmxItemname+"</td>\n" +
                        "                     <td class=\"scgl_scgl_thirdtable_tr_td\">"+data[i].scglScjhmxSpecifications+"</td>\n" +
                        "                     <td class=\"scgl_scgl_thirdtable_tr_td\">"+data[i].scglScjhmxUnit+"</td>\n" +
                        "                     <td class=\"scgl_scgl_thirdtable_tr_td\">"+data[i].scglScjhmxDemandnum+"</td>\n" +
                        "                     <td class=\"scgl_scgl_thirdtable_tr_td\">"+data[i].scglScjhmxStartdate+"</td>\n" +
                        "                     <td class=\"scgl_scgl_thirdtable_tr_td\">"+data[i].scglScjhmxOverdate+"</td>\n" +
                        "                 </tr>"
                   $("#scgl_scgl_thirdtable").append(html);
                   }
                }, "json");

        });
        var scgl_scjhmx_demandNum=null;
        layui.use('laydate', function(){
            var laydate = layui.laydate;
            laydate.render({
                elem: '#scgl_scjh_documentDate' //指定元素
            });

        });

        function scgl_myradio(scgl_ScjhmxItemnum,scglScjhmxDemandnum,scgl_xuanzheid) {
            if($("#scgl_xuanzhe"+scgl_xuanzheid+"").is(":checked")==true){
                scgl_scjhmx_demandNum=scglScjhmxDemandnum;
               $.get("/scgl_scjhInsertSess?scgl_xuanzhe="+scgl_ScjhmxItemnum,null,function () {
                   console.log(scgl_scjh_documentDate);

               });
            }
        }
        function verify() {
            var scgl_scjh_documentNum = $("#scgl_scjh_documentNum").val();
            var scgl_scjh_subject = $("#scgl_scjh_subject").val();
            var scgl_scjh_personInCharge = $("#scgl_scjh_personInCharge").val();
            var scgl_scjh_project = $("#scgl_scjh_project").val();
            var scgl_scjh_department = $("#scgl_scjh_department").val();
            var scgl_scjh_allProductionNum = $("#scgl_scjh_allProductionNum").val();
            var scgl_scjh_singlePlayer = $("#scgl_scjh_singlePlayer").val();
            var scgl_scjh_documentDate = $("#scgl_scjh_documentDate").val();
            if(scgl_scjhmx_demandNum>scgl_scjh_allProductionNum){
                alert("计划数必须大于等于需求数");
                return  false
            }
            if (scgl_scjh_documentNum ==null||scgl_scjh_documentNum=="") {
                alert('单据编号不能为空');
                return false;
            }
            if (scgl_scjh_subject == null||scgl_scjh_subject=="") {
                alert('主题不能为空');
                return false;
            }
            if (scgl_scjh_personInCharge == null ||scgl_scjh_personInCharge=="") {
                alert('负责人不能为空');
                return false;
            }
            if (scgl_scjh_project ==null ||scgl_scjh_project=="") {
                alert('项目不能为空');
                return false;
            }
            if (scgl_scjh_department == null||scgl_scjh_department=="" ) {
                alert('部门不能为空');
                return false;
            }
            if (scgl_scjh_allProductionNum ==null||scgl_scjh_allProductionNum=="") {
                alert('生产计划数量总量不能为空');
                return false;
            }
            if (scgl_scjh_singlePlayer == null ||scgl_scjh_singlePlayer=="") {
                alert('制单人不能为空');
                return false;
            }
            if (scgl_scjh_documentDate ==null||scgl_scjh_documentDate=="" ) {
                alert('制单日期不能为空');
                return false;
            }
            if($("#scgl_xuanzhe1").is(":checked")==false&&$("#scgl_xuanzhe2").is(":checked")==false&&
                $("#scgl_xuanzhe3").is(":checked")==false&&
                $("#scgl_xuanzhe4").is(":checked")==false){
                alert("订单必选!");
                return false;
            }
        }

    </script>
    <style>
        .scgl_scgl_firstul {
            margin-top: 10px;
        }

        .scgl_scgl_firstul li {
            list-style: none;
            float: left;
            margin-left: 10px;
        }
        .scgl_scgl_firstdiv {

            height: 55px;
            width: 100%;
            border: 2px solid slategray;
        }
        .scgl_scgl_secontdiv {
            margin-top: 10px;
            width: 100%;
            height: 150px;
        }
        .scgl_scgl_firsttable {
            width: 100%;
            height: 100%;
            border:slategray 2px solid ;

        }
        .scgl_scgl_firsttable tr {
            border-bottom: 2px solid slategray;

        }
        .scgl_scgl_firsttable_tr_td {
            background-color: #FFFFF0;
            border-right: 2px solid slategray;
            width: 14%;
            height: 25%;

        }
        .scgl_scgl_firsttable_tr_td01 {
            border-right: 2px solid slategray;
            width: 14%;
            height: 25%;

        }
        .scgl_scgl_firsttable_tr_td01 input{
            border: none;
            width: 100%;
            height: 100%;
        }
        .scgl_scgl_thirdiv {
            margin-top: 10px;
            width: 100%;
            height: 300px;
        }
        .scgl_scgl_secondtable {

            width: 100%;
            height: 100%;
            border:slategray 2px solid ;
        }

        .scgl_scgl_secondtable tr{
            border-bottom: 2px solid slategray;
        }

        .scgl_scgl_secondtable_tr_td {
            background-color: #FFFFF0;
            border-right: 2px solid slategray;
            width: 14%;
            height: 14%;
        }
        .scgl_scgl_secondtable_tr_td01 input {
            border: none;
            width: 100%;
            height: 100%;
        }
        .scgl_scgl_secondtable_tr_td01 {
            border-right: 2px solid slategray;
            width: 14%;
            height: 14%;
        }
        .scgl_scgl_fourthdiv {
            margin-top: 10px;
            width: 100%;
            height: 100px;

        }
        .scgl_scgl_thirdtable {
            width: 100%;
            height: 100%;
            border:slategray 2px solid ;
            text-align: center;

        }
        .scgl_scgl_thirdtable tr{
            border-bottom: 2px solid slategray;
        }
        .scgl_scgl_thirdtable_tr_td {

            border-right: 2px solid slategray;
            width: 11%;
            height: 30px;
        }
    </style>
</head>
<body>

<div style="background-color: white">
    <!--页面主题-->
    <div style="height: 50px;width: 100%; font-weight: bold;text-align: center;font-size: 30px">新建主生产计划</div>
    <!--form表单-->
    <form action="/scgl_scjhInsert" onsubmit="return verify()">
        <!--操作按钮-->
        <div class="scgl_scgl_firstdiv">
            <ul class="scgl_scgl_firstul">
                <li><input class="layui-btn layui-btn-radius" type="submit" value="保存"></li>
            </ul>
        </div>
        <!--需要填写的详细信息-->
        <div class="scgl_scgl_secontdiv">
            <table class="scgl_scgl_firsttable" cellpadding="0px" cellspacing="0px" border="2px" >
<!--               第一行-->
                <tr>
                    <td colspan="6">基本信息</td>
                </tr>
<!--                第二行-->
                <tr>
                    <td class="scgl_scgl_firsttable_tr_td">单据编号</td>
                    <td class="scgl_scgl_firsttable_tr_td01">
                        <input  type="text" id="scgl_scjh_documentNum" name="scgl_scjh_documentNum"/>
                    </td>
                    <td class="scgl_scgl_firsttable_tr_td">主题</td>
                    <td class="scgl_scgl_firsttable_tr_td01">
                        <input  type="text" id="scgl_scjh_subject" name="scgl_scjh_subject"/>
                    </td>
                    <td class="scgl_scgl_firsttable_tr_td">负责人</td>
                    <td class="scgl_scgl_firsttable_tr_td01">
                        <input  type="text" id="scgl_scjh_personInCharge" name="scgl_scjh_personInCharge"/>
                    </td>
                </tr>
<!--               第三行-->
                <tr >
                    <td class="scgl_scgl_firsttable_tr_td">部门</td>
                    <td colspan="5" class="scgl_scgl_firsttable_tr_td01">
                        <input  type="text"  id="scgl_scjh_department" name="scgl_scjh_department"/>
                    </td>
                </tr>
<!--              第四行-->
                <tr >
                    <td class="scgl_scgl_firsttable_tr_td">项目</td>
                    <td colspan="5" class="scgl_scgl_firsttable_tr_td01">
                        <input  type="text" id="scgl_scjh_project"  name="scgl_scjh_project"/>
                    </td>
                </tr>
            </table>
        </div>
        <!-- /基本信息下需要填写的信息-->
        <!--     合计信息   -->
        <div class="scgl_scgl_thirdiv">
            <table class="scgl_scgl_secondtable" cellpadding="0px" cellspacing="0px" border="2px" >
                <!--               第一行-->
                <tr>
                    <td colspan="6">合计信息</td>
                </tr>
                <!--                第二行-->
                <tr>
                    <td class="scgl_scgl_secondtable_tr_td">生产计划数量合计</td>
                    <td class="scgl_scgl_secondtable_tr_td01" colspan="5">
                        <input  type="text" id="scgl_scjh_allProductionNum"  name="scgl_scjh_allProductionNum"/>
                    </td>

                </tr>
                <!--     第三行-->
                <tr>
                    <td colspan="6">备注信息</td>
                </tr>

                <!--               第四行-->
                <tr>
                    <td class="scgl_scgl_secondtable_tr_td">单据状态</td>
                    <td class="scgl_scgl_secondtable_tr_td01">
                        <input  type="text" id="scgl_scjh_billsStatus"  name="scgl_scjh_billsStatus"/>
                    </td>
                    <td class="scgl_scgl_secondtable_tr_td">制单人</td>
                    <td class="scgl_scgl_secondtable_tr_td01">
                        <input  type="text" id="scgl_scjh_singlePlayer" name="scgl_scjh_singlePlayer"/>
                    </td>
                    <td class="scgl_scgl_secondtable_tr_td">制单日期</td>
                    <td class="scgl_scgl_secondtable_tr_td01">
                        <input type="text" name="scgl_scjh_documentDate" class="layui-input" id="scgl_scjh_documentDate">
                    </td>
                </tr>
                <!--              第五行-->
                <tr>
                    <td class="scgl_scgl_secondtable_tr_td">确认人</td>
                    <td class="scgl_scgl_secondtable_tr_td01">
                        <input  type="text" id="scgl_scjh_confirmPeople"  name="scgl_scjh_confirmPeople"/>
                    </td>
                    <td class="scgl_scgl_secondtable_tr_td">确认日期</td>
                    <td class="scgl_scgl_secondtable_tr_td01">
                        <input type="text" name="scgl_scjh_confirmDate" class="layui-input " id="scgl_scjh_confirmDate">
                    </td>
                    <td class="scgl_scgl_secondtable_tr_td">结单人</td>
                    <td class="scgl_scgl_secondtable_tr_td01">
                        <input  type="text" id="scgl_scjh_statementPeople" name="scgl_scjh_statementPeople"/>
                    </td>
                </tr>
                <!--              第六行-->
                <tr>
                    <td class="scgl_scgl_secondtable_tr_td">结单日期</td>
                    <td class="scgl_scgl_secondtable_tr_td01">
                        <input  type="text" id="scgl_scjh_dateofOrder" name="scgl_scjh_dateofOrder"/>
                    </td>
                    <td class="scgl_scgl_secondtable_tr_td">最后更新人</td>
                    <td class="scgl_scgl_secondtable_tr_td01">
                        <input  type="text" id="scgl_scjh_lastUpdatePeople" name="scgl_scjh_lastUpdatePeople"/>
                    </td>
                    <td class="scgl_scgl_secondtable_tr_td">最后更新日期</td>
                    <td class="scgl_scgl_secondtable_tr_td01">
                        <input  type="text" id="scgl_scjh_lastUpdateDate" name="scgl_scjh_lastUpdateDate"/>
                    </td>
                </tr>
                <!--     第七行-->
                <tr>
                    <td class="scgl_scgl_secondtable_tr_td">备注</td>
                    <td class="scgl_scgl_secondtable_tr_td01" colspan="5">
                        <input  type="text" id="scgl_scjh_remarks"  name="scgl_scjh_remarks"/>
                    </td>
                </tr>
            </table>
        </div>

</div>
<!--生产明细-->
<div style="width: 100%;height: 20px;margin-top: 20px"><span style="color: red;font-weight: bold">生产计划明细</span></div>
<!--生产明细的折叠框-->

    <div class="layui-collapse" lay-accordion="" >
        <div class="layui-colla-item">
            <h2 class="layui-colla-title" style="text-align: center">收起栏目</h2>
            <div class="layui-colla-content layui-show" >
                <div class="scgl_scgl_fourthdiv" >
                    <table id="scgl_scgl_thirdtable" class="scgl_scgl_thirdtable" cellpadding="0px" cellspacing="0px" border="2px">
                        <tr>
                            <td class="scgl_scgl_thirdtable_tr_td">选择订单</td>
                            <td class="scgl_scgl_thirdtable_tr_td">序号</td>
                            <td class="scgl_scgl_thirdtable_tr_td">物品编号</td>
                            <td class="scgl_scgl_thirdtable_tr_td">物品名称</td>
                            <td class="scgl_scgl_thirdtable_tr_td">规格</td>
                            <td class="scgl_scgl_thirdtable_tr_td">基本单位</td>
                            <td class="scgl_scgl_thirdtable_tr_td">需求数量</td>
                            <td class="scgl_scgl_thirdtable_tr_td">计划开工日期</td>
                            <td class="scgl_scgl_thirdtable_tr_td">计划完工日期</td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
    </div>




<!--折叠筐的js-->
<script>
    layui.use(['element', 'layer'], function(){
        var element = layui.element;
        var layer = layui.layer;

        //监听折叠
        element.on('collapse(test)', function(data){
            layer.msg('展开状态：'+ data.show);
        });
    });
</script>
<!--/折叠筐的js-->
<!--/生产明细的折叠框-->
</form>
<!--/form表单-->
</body>
</html>